package com.china.great.common.common;

public class CommonResultUtil {

    /**成功且带数据**/
    public static CommonResult success(Object object){
        CommonResult result = new CommonResult();
        result.setCode(CommonResultEnum.SUCCESS.getCode());
        result.setMsg(CommonResultEnum.SUCCESS.getMsg());
        result.setData(object);
        return result;
    }

    /**失败且带数据**/
    public static CommonResult err(Object object){
        CommonResult result = new CommonResult();
        result.setCode(CommonResultEnum.SERVER_INTERNAL_ERROR.getCode());
        result.setMsg(CommonResultEnum.SERVER_INTERNAL_ERROR.getMsg());
        result.setData(object);
        return result;
    }

    /**token过期**/
    public static CommonResult tokenErr(){
        CommonResult result = new CommonResult();
        result.setCode(CommonResultEnum.TOKEN_FAILE.getCode());
        result.setMsg(CommonResultEnum.TOKEN_FAILE.getMsg());
        return result;
    }

}
